﻿
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement;


namespace  Example_AssetReference
{
    public class LoadAssetScript : MonoBehaviour
    {
        [SerializeField]
        private AssetReference _assetRef;                               //AssetReference直接引用所有标记了Addressable的资源。

        private void Start()
        {
            _assetRef.Instantiate<GameObject>().Completed += OnLoaded;
        }

        private void OnLoaded(IAsyncOperation<GameObject> obj)
        {
            GameObject instance = obj.Result;
        }
    }
}
